//package com.example.wjy.util;
//
//import android.content.Context;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.TextView;
//
//import androidx.recyclerview.widget.RecyclerView;
//
//import com.example.superyi.myteam.R;
//
//import java.util.ArrayList;
//
//public class RecyclerViewDeleteAdapter extends RecyclerView.Adapter<RecyclerViewDeleteAdapter.MyViewHolder>{
//    private Context mContext;
//    private ArrayList<String> dataList;
//    private CustomRecyclerView recyclerView;
//    public RecyclerViewDeleteAdapter(Context mContext, CustomRecyclerView recyclerView, ArrayList<String> dataList){
//        this.mContext = mContext;
//        this.dataList = dataList;
//        this.recyclerView = recyclerView;
//    }
//
//    @Override
//    public RecyclerViewDeleteAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//        RecyclerViewDeleteAdapter.MyViewHolder holder = new RecyclerViewDeleteAdapter.MyViewHolder(LayoutInflater.from(mContext)
//                .inflate(R.layout.item_delete_recycler_view,parent,false));
//        return holder;
//    }
//
//    @Override
//    public void onBindViewHolder(RecyclerViewDeleteAdapter.MyViewHolder holder, int position) {
//        final  int itemPosition = position;
//        holder.tvTitle.setText(dataList.get(position)+position);
//        //给删除按钮设置点击事件的监听器
//        holder.tvDelete.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                //移除数据
//                dataList.remove(itemPosition);
//                //回归默认状态
//                recyclerView.backToNormal();
//                //更新数据
//                notifyItemRemoved(itemPosition);
//                notifyItemRangeRemoved(itemPosition,getItemCount() - itemPosition);
//                //notifyDataSetChanged();//更新数据
//            }
//        });
//    }
//
//    @Override
//    public int getItemCount() {
//        return dataList.size();
//    }
//
//    class MyViewHolder extends RecyclerView.ViewHolder {
//        TextView tvTitle;
//        TextView tvDelete;
//        public MyViewHolder(View itemView){
//            super(itemView);
//            tvTitle = (TextView)itemView.findViewById(R.id.tv_title);
//            tvDelete = (TextView) itemView.findViewById(R.id.tv_delete);
//        }
//    }
//}
